﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class NguyenTuanAnh02 : System.Web.UI.Page
{
    DBAccess db = new DBAccess();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack) return;
        loadGrid();
        
    }
    //public void add()
    //{
    //    db.con.Open();
    //    SqlDataAdapter da = new SqlDataAdapter("select * from LOAI_HANG where [ID_LOAI_HANG]=" + Request.QueryString["ID_LOAI_HANG"] + ";", db.con);
    //    DataTable dt = new DataTable();
    //    da.Fill(dt);
    //    dt.Columns.Add("SOLUONG", typeof(int), "ID_LOAI_HANg*2");
    //    GridView1.DataSource = dt;
    //    GridView1.DataBind();
    //}
    public void loadGrid()
    {
        db.con.Open();
        SqlDataAdapter da = new SqlDataAdapter("select * from LOAI_HANg", db.con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
    protected void lbtn_Click(object sender, EventArgs e)
    {
        LinkButton A = (LinkButton)sender;
        Response.Redirect("NguyenTuanAnh03.aspx?id=" + A.CommandName + "");
    }
}